package easy;

public class Solution_1572 {

    public int diagonalSum(int[][] mat) {
        int left = 0, right = 0;
        for (int i = 0, j = mat.length - 1; i < mat.length; i++, j--) {
            left += mat[i][i];
            right += mat[i][j];
        }
        int sub = 0;
        if (mat.length % 2 == 1) {
            sub = mat[mat.length >> 1][mat.length >> 1];
        }
        return left + right - sub;
    }

    public static void main(String[] args) {
        Solution_1572 model = new Solution_1572();
    }
}
